﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using IDAL.RF.PowerTest;
using Model.RF.PowerTest;

namespace DAL.RF.PowerTest
{
    public class PowerTestItem : BaseRepository_DT<PowerTestItemInfo>, IPowerTestItem
    {
        #region 静态变量部分
        private const string PARM_POWERTEST_ID = "@ID";
        #endregion

        #region 数据检索部分
        public IList<PowerTestItemInfo> LoadEntities()
        {
            return null;
        }

        public PowerTestItemInfo LoadEntity<T1>(T1 Id)
        {
            return null;
        }

        public IList<PowerTestItemInfo> GetPowerTestItemsbyID(int id)
        {
            SqlParameter parm = GetParameter();
            parm.Value = id;
            return ExcuteSqlToGetEntities("PowerTestItem_selectbyID", parm);
        }


        public IList<PowerTestItemInfo> GetPowerTestItem_tempsbyID(int id)
        {
            SqlParameter parm = GetParameter();
            parm.Value = id;
            return ExcuteSqlToGetEntities("PowerTestItem_temp_selectbyID", parm);
        }
        #endregion


        #region 重写基类部分
        //-------------------------------------重写超类基础操作---------------------------------------------------------

        public override PowerTestItemInfo GetEntityRecord(SqlDataReader rdr)
        {
            PowerTestItemInfo pro = new PowerTestItemInfo()
            {
                ID = rdr.GetInt32(0),
                TestPort = rdr.GetValue(1).ToString(),
                StartTime = rdr.GetDateTime(2),
                Duration = rdr.GetInt32(3),
                FrePoint = rdr.GetDecimal(4),
                InputPower = rdr.GetDecimal(5),
                LowLimit = rdr.GetDecimal(6),
                Measurement = rdr.GetDecimal(7),
                IsPass = rdr.GetBoolean(8)
            };
            return pro;
        }

        public override PowerTestItemInfo GetEntityRecord()
        {
            PowerTestItemInfo pro = new PowerTestItemInfo();
            return pro;
        }

        public override string GetInsertsp()
        {
            return null;
        }

        public override string GetUpdatesp()
        {
            return null;
        }

        public override string GetDeletesp()
        {
            return null;
        }

        public override SqlParameter GetParameter()
        {
            SqlParameter Parm = new SqlParameter(PARM_POWERTEST_ID, SqlDbType.Int, 4);
            return Parm;
        }
        #endregion
    }
}
